/**
 * Created by luckyjing on 16/3/25.
 */
var webpack = require('webpack');
module.exports = {
    devtool: 'cheap-module-eval-source-map',
    entry: [
        'webpack/hot/only-dev-server',
        'webpack-dev-server/client?http://localhost:3002',
        "./public/main/index.js"
    ],
    output: {
        path: './public/',
        filename: "bundle.js",
        publicPath: 'http://localhost:3002/'
    },
    module: {
        loaders: [
            {test: /\.css$/, loader: "style!css"},
            {
                test: /\.jsx*$/,
                exclude: /node_modules/,
                loader: "babel",
                query: //   传递参数给babel，就像我们使用.babelrc文件一样
                {
                    presets: ['react', 'es2015']
                }
            }
        ]
    },
    resolve: {
        // 填在这里的表示可以进行自动补全后缀
        extensions: ['', '.js', '.jsx', '.json']
    },
    devServer: {
        hot: true,
        inline: true,
        port: 3002
    },
    plugins: [
        new webpack.NoErrorsPlugin(),
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.ProvidePlugin({
            'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
        })
    ]
};
